import "mod_draw";
import "mod_key";
import "mod_map";
import "mod_math";
import "mod_proc";
import "mod_grproc";
import "mod_screen";
import "mod_text";
import "mod_file";
import "mod_video";
import "mod_debug";
import "mod_say";
import "mod_sound";
import "mod_wm";
import "mod_rand";

//---------------------------------------------------------------------------------------
CONST

	SCREEN_X	= 640;
	SCREEN_Y	= 480;

END

//---------------------------------------------------------------------------------------
GLOBAL
	lowres = FALSE;
END

//---------------------------------------------------------------------------------------
include "prg/funciones.prg";
include "prg/ts.prg";
include "prg/ts-editor.prg";

//---------------------------------------------------------------------------------------
BEGIN

	set_title("Tiled Scroll Editor");
	set_mode(SCREEN_X, SCREEN_Y, 16, MODE_WINDOW);
	set_fps(60,0);
	
	
	bg_fpg = load_fpg("fpg/bg.fpg");

	//carga el mapa
	load("maps/map1.dat", map);

	tsManager(0, 0, SCREEN_X, SCREEN_Y);
	tsMove();
	tsEditor();
	
	//tsMapFill();
	
	// muestra posicion actual del scroll
	varMonitor(0, 10, "ts.pos.x", &ts.pos.x);
	varMonitor(0, 20, "ts.pos.y", &ts.pos.y);
	write_var(0,0,0,0,fps);

	LOOP
	
		IF ( key ( _esc ) )
			exit();
		END
		
		IF ( key ( _f1 ) and lowres == false)
			lowres = true;
			scale_mode = SCALE_NOFILTER;
			set_mode(SCREEN_X, SCREEN_Y, 16, MODE_WINDOW);
		END
		
	
		frame;
		
	END
	
END
